package com.bupt.smart.ui.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.widget.ScrollView;

import com.bupt.smart.utils.DensityUtil;

/**
 * Created by HH on 2016/6/22.
 */
public class ScrollerView extends ScrollView {
    private  boolean mIsBeingDragged;
    Context mycontext;
    int TRIGGER;
    float orginX,mLastMotionY,y;
    float deltaX,deltaY;
    float curX,curY;
    FlipperListView flipperListView;
    public ScrollerView(Context context) {
        super(context);
    }

    public ScrollerView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }
    public void InitScrollerView(Context context,FlipperListView flipperListView){
        this.mycontext = context;
        this.mIsBeingDragged = false;
        this.flipperListView = flipperListView;
        TRIGGER = DensityUtil.dip2px(mycontext,60);

    }

    //OnTouch事件交由FlipperListView处理
//    @Override
//    public boolean onInterceptTouchEvent(MotionEvent e){
//        int action = e.getAction();
//        if ((action == MotionEvent.ACTION_MOVE) && (mIsBeingDragged)) {
//            return true;
//        }
//        y = e.getY();
//        switch(action){
//            case MotionEvent.ACTION_DOWN:{
//                Log.i("action","ACTION_DOWN from scroll");
//                this.mLastMotionY = y;
//            }break;
//            case MotionEvent.ACTION_UP:{
//                Log.i("action","ACTION_UP from scroll");
//                mIsBeingDragged = false;
//            }
//
//                break;
//            case MotionEvent.ACTION_MOVE:{
//                final int yDiff = (int) Math.abs(y - mLastMotionY);
//                if (yDiff > TRIGGER) {
//                    mIsBeingDragged = true;
//                }
//            }break;
//            default:{}
//        }
//        return mIsBeingDragged;
//    }


}
